#define CDR_NORMAL   0
#define CDR_NEXT     1
#define CDR_NOT_CONS 2
#define CDR_FORW     3

#define TYPE_MULTICELL 4

#define get_tag(ref)      ( (unsigned int)(ref) &  3)
#define untag(ref) ((cell)( (unsigned int)(ref) & ~3)           )
#define tag(ref,t) ((cell)(((unsigned int)(ref) & ~3) | (t & 3)))

#define get_type(ref) ((unsigned int)(ref)&0xFFFF)
#define get_data(ref) ((unsigned int)(ref)>>16)
#define multicell_head(len, t) ((cell)((unsigned int)(len) << 16 | (t) | TYPE_MULTICELL))
#define is_multicell(ref) ((unsigned int)(ref) & TYPE_MULTICELL)

const static unsigned int EOL    =            CDR_NOT_CONS;
const static unsigned int SHORT  = (1 << 3) | CDR_NOT_CONS;
const static unsigned int EMPTY  = (2 << 3) | CDR_NOT_CONS;
const static unsigned int STRING = (3 << 3) | CDR_NOT_CONS | TYPE_MULTICELL;
const static unsigned int CHAR   = (3 << 3) | CDR_NOT_CONS;
const static unsigned int SYMBOL = (4 << 3) | CDR_NOT_CONS | TYPE_MULTICELL;
const static unsigned int CFUNC  = (5 << 3) | CDR_NOT_CONS | TYPE_MULTICELL;
const static unsigned int LFUNC  = (6 << 3) | CDR_NOT_CONS | TYPE_MULTICELL;
const static unsigned int BOOL   = (7 << 3) | CDR_NOT_CONS;


extern cell mem_start, mem_free, mem_end;
